package com.wkhyapp.lm.contract;

import com.wkhyapp.lm.base.BaseActivity;
import com.wkhyapp.lm.base.BasePresenter;
import com.wkhyapp.lm.http.ApiCallback;
import com.wkhyapp.lm.http.net.BaseRequest;
import com.wkhyapp.lm.http.net.GoodsInfoRequest;
import com.wkhyapp.lm.http.net.SuperResponse;
import com.wkhyapp.lm.http.net.SupplierRequest;
import com.wkhyapp.lm.http.vo.Category;
import com.wkhyapp.lm.http.vo.Goods;
import com.wkhyapp.lm.utils.MemberUtils;

/**
 * Created by fang on 2021/10/13.
 */

public class CheckInPresenter extends BasePresenter<CheckInView> {

    public CheckInPresenter(CheckInView checkInView) {
        super(checkInView);
    }

    public void submit(String phone,String wx,int cid){
        SupplierRequest request = new SupplierRequest();
        request.setUserId(MemberUtils.getUid());
        request.setCategoryId(cid);
        request.setPhone(phone);
        request.setWx(wx);
        addSubscription(apiStores.supplier(request),new ApiCallback<SuperResponse<String>>() {
            @Override
            public void onSuccess(SuperResponse<String> response) {
                mvpView.setSucc(response.getMessage());
            }
            @Override
            public void onFailure(String msg) {
                mvpView.setFial(msg);
            }

            @Override
            public void onFinish() {
                mvpView.dismissLoad();
            }
        });

    }



    public void getCategory(){
        BaseRequest request = new BaseRequest();
        addSubscription(apiStores.getCategory(request),new ApiCallback<SuperResponse<Category>>() {
            @Override
            public void onSuccess(SuperResponse<Category> response) {
                mvpView.setCategory(response.getItems());
            }
            @Override
            public void onFailure(String msg) {
//                mvpView.setfail("");
            }

            @Override
            public void onFinish() {
                mvpView.dismissLoad();
            }
        });
    }

}
